home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / New System Software Extensions / QuickDraw™ 3D 1.0 / Development / Interfaces / QD3DShader.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-02  |  5.9 KB  |  215 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DShader.h                                             **
  4.  **                                                                             **
  5.  **                                                                             **
  6.  **     Purpose:     QuickDraw 3D Shader / Color Routines                     **
  7.  **                                                                             **
  8.  **                                                                             **
  9.  **                                                                             **
  10.  **     Copyright (C) 1991-1995 Apple Computer, Inc. All rights reserved.     **
  11.  **                                                                             **
  12.  **                                                                             **
  13.  *****************************************************************************/
  14. #ifndef QD3DShader_h
  15. #define QD3DShader_h
  16.  
  17. #ifndef QD3D_h
  18. #include "QD3D.h"
  19. #endif  /*  QD3D_h  */
  20.  
  21. #if PRAGMA_ONCE
  22.     #pragma once
  23. #endif
  24.  
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif    /* __cplusplus */
  28.  
  29. /******************************************************************************
  30.  **                                                                             **
  31.  **                                RGB Color routines                             **
  32.  **                                                                             **
  33.  *****************************************************************************/
  34.  
  35. QD3D_EXPORT TQ3ColorRGB *Q3ColorRGB_Set(
  36.     TQ3ColorRGB            *color,
  37.     float                r,
  38.     float                g,
  39.     float                b);
  40.  
  41. QD3D_EXPORT TQ3ColorARGB *Q3ColorARGB_Set(
  42.     TQ3ColorARGB        *color,
  43.     float                a,
  44.     float                r,
  45.     float                g,
  46.     float                b);
  47.  
  48. QD3D_EXPORT TQ3ColorRGB *Q3ColorRGB_Add(
  49.     const TQ3ColorRGB     *c1, 
  50.     const TQ3ColorRGB     *c2,
  51.     TQ3ColorRGB            *result);
  52.  
  53. QD3D_EXPORT TQ3ColorRGB *Q3ColorRGB_Subtract(
  54.     const TQ3ColorRGB     *c1, 
  55.     const TQ3ColorRGB     *c2,
  56.     TQ3ColorRGB            *result);
  57.  
  58. QD3D_EXPORT TQ3ColorRGB *Q3ColorRGB_Scale(
  59.     const TQ3ColorRGB     *color, 
  60.     float                scale,
  61.     TQ3ColorRGB            *result);
  62.  
  63. QD3D_EXPORT TQ3ColorRGB *Q3ColorRGB_Clamp(
  64.     const TQ3ColorRGB     *color,
  65.     TQ3ColorRGB            *result);
  66.  
  67. QD3D_EXPORT TQ3ColorRGB *Q3ColorRGB_Lerp(
  68.     const TQ3ColorRGB     *first, 
  69.     const TQ3ColorRGB     *last, 
  70.     float                 alpha,
  71.     TQ3ColorRGB         *result);
  72.  
  73. QD3D_EXPORT TQ3ColorRGB *Q3ColorRGB_Accumulate(
  74.     const TQ3ColorRGB     *src, 
  75.     TQ3ColorRGB         *result);
  76.  
  77. QD3D_EXPORT float *Q3ColorRGB_Luminance(
  78.     const TQ3ColorRGB    *color, 
  79.     float                 *luminance);
  80.  
  81.  
  82. /******************************************************************************
  83.  **                                                                             **
  84.  **                                Shader Types                                 **
  85.  **                                                                             **
  86.  *****************************************************************************/
  87.  
  88. typedef enum TQ3ShaderUVBoundary {
  89.     kQ3ShaderUVBoundaryWrap,
  90.     kQ3ShaderUVBoundaryClamp
  91. } TQ3ShaderUVBoundary;
  92.  
  93.  
  94. /******************************************************************************
  95.  **                                                                             **
  96.  **                                Shader Routines                                 **
  97.  **                                                                             **
  98.  *****************************************************************************/
  99.  
  100. QD3D_EXPORT TQ3ObjectType Q3Shader_GetType(
  101.     TQ3ShaderObject            shader);
  102.  
  103. QD3D_EXPORT TQ3Status Q3Shader_Submit(
  104.     TQ3ShaderObject            shader, 
  105.     TQ3ViewObject            view);
  106.  
  107. QD3D_EXPORT TQ3Status Q3Shader_SetUVTransform(
  108.     TQ3ShaderObject            shader,
  109.     const TQ3Matrix3x3        *uvTransform);
  110.  
  111. QD3D_EXPORT TQ3Status Q3Shader_GetUVTransform(
  112.     TQ3ShaderObject            shader,
  113.     TQ3Matrix3x3            *uvTransform);
  114.  
  115. QD3D_EXPORT TQ3Status Q3Shader_SetUBoundary(
  116.     TQ3ShaderObject            shader,
  117.     TQ3ShaderUVBoundary        uBoundary);
  118.  
  119. QD3D_EXPORT TQ3Status Q3Shader_SetVBoundary(
  120.     TQ3ShaderObject            shader,
  121.     TQ3ShaderUVBoundary        vBoundary);
  122.  
  123. QD3D_EXPORT TQ3Status Q3Shader_GetUBoundary(
  124.     TQ3ShaderObject            shader,
  125.     TQ3ShaderUVBoundary        *uBoundary);
  126.  
  127. QD3D_EXPORT TQ3Status Q3Shader_GetVBoundary(
  128.     TQ3ShaderObject            shader,
  129.     TQ3ShaderUVBoundary        *vBoundary);
  130.  
  131.  
  132. /******************************************************************************
  133.  **                                                                             **
  134.  **                            Illumination Shader    Classes                         **
  135.  **                                                                             **
  136.  *****************************************************************************/
  137.  
  138. QD3D_EXPORT TQ3ObjectType Q3IlluminationShader_GetType(
  139.     TQ3ShaderObject                shader);
  140.  
  141. QD3D_EXPORT TQ3ShaderObject Q3PhongIllumination_New(
  142.     void);
  143.  
  144. QD3D_EXPORT TQ3ShaderObject Q3LambertIllumination_New(
  145.     void);
  146.  
  147. QD3D_EXPORT TQ3ShaderObject Q3NULLIllumination_New(
  148.     void);
  149.  
  150.  
  151. /******************************************************************************
  152.  **                                                                             **
  153.  **        Texture Shader  - may use any type of Texture. (only 1 type in 1.0)     **
  154.  **                                                                             **
  155.  *****************************************************************************/
  156.  
  157. QD3D_EXPORT TQ3ShaderObject Q3TextureShader_New(
  158.     TQ3TextureObject            texture);
  159.  
  160. QD3D_EXPORT TQ3Status Q3TextureShader_GetTexture(
  161.     TQ3ShaderObject                shader,
  162.     TQ3TextureObject            *texture);
  163.  
  164. QD3D_EXPORT TQ3Status Q3TextureShader_SetTexture(
  165.     TQ3ShaderObject                shader,
  166.     TQ3TextureObject            texture);
  167.  
  168.  
  169. /******************************************************************************
  170.  **                                                                             **
  171.  **        Texture Objects - For 1.0, there  is 1 subclass: PixmapTexture.         **
  172.  **        More subclasses will be added in later releases.                     **
  173.  **            (e.g. PICTTexture, GIFTexture, MipMapTexture)                     **
  174.  **                                                                             **
  175.  *****************************************************************************/
  176.  
  177. QD3D_EXPORT TQ3ObjectType Q3Texture_GetType(
  178.     TQ3TextureObject        texture);
  179.  
  180. QD3D_EXPORT TQ3Status Q3Texture_GetWidth(
  181.     TQ3TextureObject        texture,
  182.     unsigned long            *width);
  183.  
  184. QD3D_EXPORT TQ3Status Q3Texture_GetHeight(
  185.     TQ3TextureObject        texture,
  186.     unsigned long            *height);
  187.  
  188.  
  189. /******************************************************************************
  190.  **                                                                             **
  191.  **        Pixmap Texture                                                         **
  192.  **            The TQ3StoragePixmap must contain a TQ3StorageObject that is a     **
  193.  **            Memory Storage ONLY for 1.0. We will support other storage          **
  194.  **            classes in later releases.                                         **
  195.  **                                                                             **
  196.  *****************************************************************************/
  197.  
  198. QD3D_EXPORT TQ3TextureObject Q3PixmapTexture_New(
  199.     const TQ3StoragePixmap    *pixmap);
  200.  
  201. QD3D_EXPORT TQ3Status Q3PixmapTexture_GetPixmap(
  202.     TQ3TextureObject        texture,
  203.     TQ3StoragePixmap        *pixmap);
  204.  
  205. QD3D_EXPORT TQ3Status Q3PixmapTexture_SetPixmap(
  206.     TQ3TextureObject        texture,
  207.     const TQ3StoragePixmap    *pixmap);
  208.  
  209.  
  210. #ifdef __cplusplus
  211. }
  212. #endif    /* __cplusplus */
  213.  
  214. #endif  /*  QD3DShader_h  */
  215.